/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ru.ruchin.tek.employees.json;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import ru.ruchin.tek.employees.data.Department;
import ru.ruchin.tek.employees.data.Employee;

/**
 *
 * @author yruchin
 */
public class GsonUtils {
    public static Gson getSharedGson() {
        GsonBuilder gb = new GsonBuilder();
        
        gb.registerTypeAdapter(Employee.class, new EmployeeGsonSerializer());
        gb.registerTypeAdapter(Department.class, new DepartmentGsonSerializer());
        gb.registerTypeAdapter(Department[].class, new DepartmentListGsonSerializer());

        return gb.create();
    }
}
